package com.wzj.uarmor.controller;

import com.wzj.uarmor.service.IVirusKillService;
import com.wzj.uarmor.utils.ResponseStatus;
import com.wzj.uarmor.utils.ResponseVO;
import com.wzj.uarmor.utils.ResultUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 病毒查杀日志
 *
 * @author whong
 * @date 2023/03/18
 */
@RestController
@RequestMapping("/virusKill")
@RequiredArgsConstructor
public class VirusKillController {

    private final IVirusKillService virusKillService;

    /**
     * 病毒查杀日志列表
     *
     * @return {@link ResponseVO}
     */
    @GetMapping("/list")
    public ResponseVO list() {
        return ResultUtil.success("成功", virusKillService.list());


    }

    /**
     * 清空日志
     * @return {@link ResponseVO}
     */
    @GetMapping("/deleteAll")
    public ResponseVO deleteAll() {
        //清空日志
        virusKillService.deleteAllLog();
        return ResultUtil.success(ResponseStatus.SUCCESS);
    }

    /**
     * 删除日志
     * @param ids id
     * @return {@link ResponseVO}
     */
    @PostMapping("/deleteBatch")
    public ResponseVO deleteBatch(@RequestBody List<Integer> ids) {
        //清空日志
        virusKillService.removeByIds(ids);
        return ResultUtil.success(ResponseStatus.SUCCESS);
    }

    /**
     * 导出全部日志
     *
     * @return {@link ResponseVO}
     */
    @GetMapping("/export")
    public ResponseVO logsExport() {
        return ResultUtil.success(ResponseStatus.SUCCESS);
    }
}
